#include Servo esc; // create servo object to control the ESC int escPin = 29; // the pin where the ESC is connected void setup() { esc.attach(escPin); // attaches the ESC on pin 9 to the servo object esc.writeMicroseconds(1000); // send minimum throttle signal (adjust as needed) delay(1000); // wait for the ESC to initialize } void loop() { // Increase speed gradually for(int speed = 1000; speed <= 2000; speed += 10) { esc.writeMicroseconds(speed); // send signal to ESC delay(20); // wait for 20 milliseconds } // Hold max speed for a while esc.writeMicroseconds(2000); delay(2000); // wait for 2 seconds // Decrease speed gradually for(int speed = 2000; speed >= 1000; speed -= 10) { esc.writeMicroseconds(speed); // send signal to ESC delay(20); // wait for 20 milliseconds } // Hold min speed for a while esc.writeMicroseconds(1000); delay(2000); // wait for 2 seconds }